﻿using System.ComponentModel;
using System.Text;
using FluentValidation.Results;
using System.Linq;

namespace Dogshow.Model
{
    public abstract class Entity : INotifyPropertyChanged, IFixabaleForeignKeys
    {
        protected Entity()
        {
            Status = Status.Unchanged;
        }

        public void MarkUnchanged()
        {
            Status = Status.Unchanged;
        }

        public event PropertyChangedEventHandler PropertyChanged;

        protected void OnPropertyChanged(string property)
        {
            
            Status = Status.Changed;
            PropertyChangedEventHandler handler = PropertyChanged;
            if (handler != null) handler(this, new PropertyChangedEventArgs(property));
        }

        public Status Status { get; set; }
        
        public virtual void FixForeignKeys()
        {
        }
    }
}